package com.ruoyi.lhky.controller;

import com.ruoyi.lhky.service.GroupService;
import com.ruoyi.lhky.util.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/group")
@Tag(name = "分组管理", description = "分组的相关操作")
public class GroupsController {

    @Autowired
    private GroupService groupService;

    @GetMapping("/getName")
    @Operation(summary = "获取分组名称", description = "根据分组ID获取分组名称")
    @ApiResponses({
            @ApiResponse(responseCode = "200", description = "获取成功"),
            @ApiResponse(responseCode = "400", description = "请求参数错误"),
            @ApiResponse(responseCode = "500", description = "服务器内部错误")
    })
    public R getGroupName(@RequestParam Long groupId) {
        return groupService.getGroupName(groupId);
    }
}

